<?php
class Test extends basicTest
{
    
    public function afterSave() {
        parent::afterSave();
        $this->saveTestCompare();
        $this->saveTestError();
    }
    
    public function saveTestError(){
       $testFile = Test_data::loadModel($this->id_test_data);
       $network = Network_teached::loadModel($this->id_network_teached);
       $array = ChartData::prepareArray($testFile->file, $network->getErrorFromFile($testFile->file), true);
       
       ChartData::saveData(ChartData::tableTest, $this->id_test, Data_network::typeError, $array);
    }
    
    public function saveTestCompare(){
       $testFile = Test_data::loadModel($this->id_test_data);
       $network = Network_teached::loadModel($this->id_network_teached);
       $array = ChartData::prepareArray($testFile->file, $network->getResultsFromFile($testFile->file));
       
       ChartData::saveData(ChartData::tableTest, $this->id_test, Data_network::typeCompare, $array);
    }


}
?>